﻿<%
sub saveplusa
For i=0 to PlusDBRootcount
PlusDBRoot.childNodes.item(i).childNodes.item(0).text=Trim(Request.Form(i&"_3"))
PlusDBRoot.childNodes.item(i).childNodes.item(1).text=Trim(Request.Form(i&"_2"))
PlusDBRoot.childNodes.item(i).attributes.item(0).value=Trim(Request.Form(i&"_1"))
next
WebsiteXmlDatas.Save(strSourceFile)
Response.Write("<script language=javascript>alert('提交成功!');this.location.href='?Fmenu=style_plus&s=a';</script>")
end sub

sub saveplusc
	dim infos
	NewPlu_Name        =nedstr(Trim(Request.Form("NewPlu_Name")))
	NewPlu_defaultTitle=nedstr(Trim(Request.Form("NewPlu_defaultTitle")))
	NewPlu_Type        =nedstr(Trim(Request.Form("NewPlu_Type")))
	NewPlu_writer        =nedstr(Trim(Request.Form("NewPlu_writer")))
	NewPlu_beat        =nedstr(Trim(Request.Form("NewPlu_beat")))
	NewPlu_Guidcode    =nedstr(Trim(Request.Form("NewPlu_Guidcode")))
	NewPlu_Url         =nedstr(Trim(Request.Form("NewPlu_Url")))
	NewPlu_ycode       =Request.Form("NewPlu_ycode")
	NewPlu_scode       =Request.Form("NewPlu_scode")
	info_=""
	for i=1 to Request.QueryString("num")
	if Trim(Request.Form("name"&i))="" then
	else
	info_=info_&"<"&Trim(Request.Form("name"&i))&">"&Trim(Request.Form("vaule"&i))&"</"&Trim(Request.Form("name"&i))&">"
	end if
	next
	infos="<?xml version='1.0' encoding='UTF-8'?><Plugin><PluginInstall><name>"&NewPlu_Name&"</name>"&_
	"<defaultTitle>"&NewPlu_defaultTitle&"</defaultTitle>"&_
	"<Type>"&NewPlu_Type&"</Type>"&_
	"<writer>"&NewPlu_writer&"</writer>"&_
	"<beat>"&NewPlu_beat&"</beat>"&_
	"<Guidcode>"&NewPlu_Guidcode&"</Guidcode>"&_
	"</PluginInstall>"&info_&"<Pluginconfig></Pluginconfig>"&_
	"</Plugin>"
	Dim fso, MyFile, MyFile1, MyFile2, MyFileObject
	Set fso = CreateObject("Scripting.FileSystemObject")
   	 If Not fso.FolderExists(server.MapPath(plus_path)&"\"&NewPlu_Url) Then
       	 fso.CreateFolder(server.MapPath(plus_path)&"\"&NewPlu_Url)
	 else
	 NewPlu_Url=NewPlu_Url&"_"&NewPlu_beat
       	 fso.CreateFolder(server.MapPath(plus_path)&"\"&NewPlu_Url)
   	 End If
	Set MyFile = fso.CreateTextFile(server.MapPath(plus_path)&"\"&NewPlu_Url&"\Info.xml", True)
	MyFile.WriteLine(infos)
	MyFile.Close
	Set MyFile1 = fso.CreateTextFile(server.MapPath(plus_path)&"\"&NewPlu_Url&"\code.asp", True)
	MyFile1.Close
	Set MyFile2 = fso.CreateTextFile(server.MapPath(plus_path)&"\"&NewPlu_Url&"\config.asp", True)
	MyFile2.Close
	Set objStream = Nothing

	'Set MyFile1 = fso.CreateTextFile(server.MapPath(plus_path)&"\"&NewPlu_Url&"\code.asp", True)
	'MyFile1.Write(NewPlu_ycode)
	'MyFile1.Close

	Dim   objStream 
        Set objStream=Server.CreateObject("ADODB.Stream") 
        With objStream 
        .Type = 2 
        .Open
        .Charset = "UTF-8" 
        .Position = 0 
        .WriteText NewPlu_ycode 
        .SaveToFile server.MapPath(plus_path)&"\"&NewPlu_Url&"\code.asp",2 

        .WriteText NewPlu_scode 
        .SaveToFile server.MapPath(plus_path)&"\"&NewPlu_Url&"\config.asp",2 
        .Close 
        End With 

	Response.Write("<script language=javascript>alert('创建成功!');this.location.href='?Fmenu=addpul&url="&NewPlu_Url&"';</script>")
 
end sub

sub savebasic
xmlcof.childNodes.item(0).text=Trim(Request.Form("blog_Name"))
xmlcof.childNodes.item(1).text=Trim(Request.Form("blog_Title"))
xmlcof.childNodes.item(2).text=Trim(Request.Form("blog_KeyWords"))
xmlcof.childNodes.item(3).text=Trim(Request.Form("blog_Description"))
xmlcof.childNodes.item(4).text=Trim(Request.Form("reg"))
xmlcof.childNodes.item(5).text=Trim(Request.Form("blog_beian"))
WebsiteXmlDatas.Save(strSourceFile)
Response.Write("<script language=javascript>alert('提交成功!');this.location.href='?Fmenu=Basic';</script>")
end sub

sub saveGravatar
xmlcof.childNodes.item(11).text=Trim(Request.Form("Gra_s"))
xmlcof.childNodes.item(12).text=Trim(Request.Form("Gra_t"))
xmlcof.childNodes.item(13).text=Trim(Request.Form("Gra_d"))
WebsiteXmlDatas.Save(strSourceFile)
Response.Write("<script language=javascript>alert('提交成功!');this.location.href='?Fmenu=Gravatar';</script>")
end sub

sub saveArticle
xmlcof.childNodes.item(8).text=Trim(Request.Form("fyc"))
xmlcof.childNodes.item(14).text=Trim(Request.Form("diary_lf"))
xmlcof.childNodes.item(14).text=Trim(Request.Form("diary_lf"))
xmlcof.childNodes.item(15).text=Trim(Request.Form("diary_yf"))
xmlcof.childNodes.item(16).text=Trim(Request.Form("diary_yh"))
xmlcof.childNodes.item(17).text=Trim(Request.Form("diary_yz"))
xmlcof.childNodes.item(18).text=Trim(Request.Form("ArticleModel"))
WebsiteXmlDatas.Save(strSourceFile)
Response.Write("<script language=javascript>alert('提交成功!');this.location.href='?Fmenu=Article';</script>")
end sub 

sub saveStyleStyle
xmlcof.childNodes.item(9).text="/"&Trim(Request.QueryString("Skinurl"))
WebsiteXmlDatas.Save(strSourceFile)
Response.Write("<script language=javascript>alert('提交成功!');this.location.href='?Fmenu=Style_Style';</script>")
end sub

sub savediary
	BL_DiaryTittle=Replace(Request.Form("name"),"<","＜")
	BL_DiaryTime=Replace(Request.Form("time"),"<","＜")
	BL_DiaryTags=Replace(Request.Form("tags"),"<","＜")
	BL_DiaryKind=Replace(Request.Form("kd"),"<","＜")
	BL_DiaryText=Request.Form("content1")
	BL_SendPin=Request.Form("sendping")
	if diarynum=-1 then
	BL_DiaryId=0
	else
	BL_DiaryId=GDInfo("diary_id",diarynum)
	end if
	BL_DiaryTittle=Replace(BL_DiaryTittle,">","＞")
	BL_DiaryTime=Replace(BL_DiaryTime,">","＞")
	BL_DiaryTags=Replace(BL_DiaryTags,">","＞")
	BL_DiaryKind=Replace(BL_DiaryKind,">","＞")


	sFile=year(now())&month(now())&day(now())&hour(now())&minute(now())&second(now())
	Dim fso, MyFile, MyFileObject
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set MyFile = fso.CreateTextFile(server.MapPath("../diary")&"/"&sFile, True)
	MyFile.WriteLine(BL_DiaryText)
	MyFile.Close
nextBL_DiaryId=BL_DiaryId+1
nextBL_DiaryId=nextBL_DiaryId&""
		set diary = WebsiteXmlDatas.createNode(1,"list","")

		set n_ = WebsiteXmlDatas.createNode(1,"num","")
		n_.text = nextBL_DiaryId
		diary.appendChild(n_)

		set n_ = WebsiteXmlDatas.createNode(1,"name","")
		n_.text = BL_DiaryTittle
		diary.appendChild(n_)

		set a_ = WebsiteXmlDatas.createNode(1,"url","")
		a_.text = "diary/"&sFile
		diary.appendChild(a_)
		set t_ = WebsiteXmlDatas.createNode(1,"time","")
		t_.text = BL_DiaryTime
		diary.appendChild(t_)
		set t_ = WebsiteXmlDatas.createNode(1,"hf","")
		diary.appendChild(t_)
		diaryl.appendChild(diary)
		Set n_1=WebsiteXmlDatas.CreateNode("attribute","tags","") 
		n_1.text=BL_DiaryTags
		diary.SetAttributeNode n_1
		Set n_2=WebsiteXmlDatas.CreateNode("attribute","fl","") 
		n_2.text=BL_DiaryKind
		diary.SetAttributeNode n_2
		Set n_3=WebsiteXmlDatas.CreateNode("attribute","un","") 
		n_3.text=ULN
		diary.SetAttributeNode n_3
		Set n_4=WebsiteXmlDatas.CreateNode("attribute","id","") 
		n_4.text=BL_DiaryId+1
		diary.SetAttributeNode n_4
		
		BL_DiaryTags=Replace(BL_DiaryTags,"，",",") 
		BL_DiaryTags=Replace(BL_DiaryTags,",," ,",")
		if right(BL_DiaryTags,1)="," then
			BL_DiaryTags=left(BL_DiaryTags,len(BL_DiaryTags)-1)
		end if
		if left(BL_DiaryTags,1)="," then
			BL_DiaryTags=right(BL_DiaryTags,len(BL_DiaryTags)-1)
		end if
		keyWord = split(BL_DiaryTags,",")
		For n= LBound(keyWord) To UBound(keyWord)
			keywordal="" 
			For i=0 to tagnum
				if keyWord(n)=tags.childNodes.item(i).text then
					keywordal="a" 
				else
					if keywordal="a" then
					else
						keywordal=""
					end if 
				end if
			next
				if keywordal="" then
					set newtag = WebsiteXmlDatas.createNode(1,"tag","")
					newtag.text = keyWord(n)
					tags.appendChild(newtag)
					set newtag = nothing
					exit for
				end if
		Next
		WebsiteXmlDatas.Save(strSourceFile)
		if BL_SendPin="on" then Call SendPing
%>

添加成功<br>
<a href="?Fmenu=newdiary">继续写日志</a><a href="?Fmenu=diarylist">返回到列表</a>
<%if err.number<>0 then%>
<p>错误<%=err.number%>:<%=err.description%>
  <%end if%>
  <%end sub

sub savekind
dim temp
temp=""
		BL_DiaryKind=Replace(Request.Form("name"),"<","＜")
		BL_DiaryKind=Replace(BL_DiaryKind,">","＞")
		for i=0 to dknum
			if diarykind.childNodes.item(i).text=BL_DiaryKind then
				temp="yes"
			end if
		next
		if temp="" then
		
			set n_ = WebsiteXmlDatas.createNode(1,"kind","")
			n_.text=BL_DiaryKind
			diarykind.appendChild(n_)
			WebsiteXmlDatas.Save(strSourceFile)
			
		end if
	echo"<script language='javascript'>"
	echo"alert('添加成功。');"
	echo"location.href='?Fmenu=kindlist&act=re'"
	echo"</script>"
end sub

sub addpul
addurl=request.QueryString("url")
for i=0 to PlusDBRootcount
plus_feed_where=PlusDBRoot.childNodes.item(i).childNodes.item(2).text
if plus_feed_where=addurl then
	echo"<script language='javascript'>"
	echo"alert('您已安装此插件');"
	echo"location.href='?Fmenu=style_plus'"
	echo"</script>"
exit sub
end if
next
Set PluginsXML = New PXML
PluginsXML.XmlPath = plus_path&"/"&addurl&"/Info.xml"
PluginsXML.Open
UnPlugName = PluginsXML.SelectXmlNodeText("Plugin/PluginInstall/name")
UnPlugWriter = PluginsXML.SelectXmlNodeText("Plugin/PluginInstall/writer")
UnPlugtype = PluginsXML.SelectXmlNodeText("Plugin/PluginInstall/Type")
UnPlugvern = PluginsXML.SelectXmlNodeText("Plugin/PluginInstall/beat")
UnPlugguid = PluginsXML.SelectXmlNodeText("Plugin/PluginInstall/Guidcode")

		set pluaddroot = WebsiteXmlDatas.createNode(1,"list","")

		set n_ = WebsiteXmlDatas.createNode(1,"type","")
		n_.text = UnPlugtype
		pluaddroot.appendChild(n_)

		set n_ = WebsiteXmlDatas.createNode(1,"name","")
		n_.text = UnPlugName
		pluaddroot.appendChild(n_)

		set n_ = WebsiteXmlDatas.createNode(1,"url","")
		n_.text = addurl
		pluaddroot.appendChild(n_)

		PlusDBRoot.appendChild(pluaddroot)

		Set n_1=WebsiteXmlDatas.CreateNode("attribute","id","") 
		n_1.text=PlusDBRootcount+1
		pluaddroot.SetAttributeNode n_1

		WebsiteXmlDatas.Save(strSourceFile)

	echo"<script language='javascript'>"
	echo"alert('添加成功。');"
	echo"location.href='?Fmenu=style_plus&act=re'"
	echo"</script>"
end sub
%>
